<template>
  <div>
    <!--面包屑导航区-->
    <el-breadcrumb separator-class="el-icon-arrow-right">
      <el-breadcrumb-item :to="{ path: '/home' }">首页</el-breadcrumb-item>
      <el-breadcrumb-item>数据统计</el-breadcrumb-item>
      <el-breadcrumb-item>数据报表</el-breadcrumb-item>
    </el-breadcrumb>
    <el-card>
      <div id="main" style="width: 600px;height:400px;"></div>
    </el-card>

  </div>
</template>

<script>
  import echarts from 'echarts'

  export default {
    name: "Report",
    data() {
      return {
        reportData: {}
      }
    },
    created() {
    },
    //此时页面上元素已经初始化完毕了
    mounted() {
      // 基于准备好的dom，初始化echarts实例
      this.$store.dispatch('getReport_').then(() => {
        this.reportData = this.$store.state.report
        var myChart = echarts.init(document.getElementById('main'));
        var option = {
          title: {
            text: 'ECharts 入门示例'
          },
          tooltip: {},

          legend: this.reportData.legend,
          xAxis: this.reportData.xAxis[0],
          yAxis: this.reportData.yAxis[0],
          series: this.reportData.series
        };
        console.log("option", option);
        // 使用刚指定的配置项和数据显示图表。
        myChart.setOption(option);
      })

    },
    methods: {
      getReport() {

      }
    }
  }
</script>

<style scoped>

</style>
